package user;

import java.io.FileNotFoundException;
import java.io.PrintWriter;


import org.omg.CORBA.ORB;
import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.PortableServer.POA;
import org.omg.PortableServer.POAHelper;
import org.omg.PortableServer.POAManagerPackage.AdapterInactive;
import org.omg.PortableServer.POAPackage.ObjectNotActive;
import org.omg.PortableServer.POAPackage.ServantAlreadyActive;
import org.omg.PortableServer.POAPackage.WrongPolicy;


public class FrontEServer  {

	/**
	 * @param args
	 * @throws InvalidName
	 * @throws ServantAlreadyActive
	 * @throws WrongPolicy
	 * @throws ObjectNotActive
	 * @throws FileNotFoundException 
	 * @throws AdapterInactive 
	 */
	public static void main(String[] args) throws InvalidName, ServantAlreadyActive, WrongPolicy, ObjectNotActive, FileNotFoundException, AdapterInactive {
		ORB orb = ORB.init(args,null);
		POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
	FrontE FE = new FrontE();
	byte[] id1 = rootPOA.activate_object(FE);
	org.omg.CORBA.Object ref1 = rootPOA.id_to_reference(id1);
	
	String ior1 = orb.object_to_string(ref1);
	System.out.println(ior1);
	PrintWriter fileFE = new PrintWriter("ior1.txt");
	fileFE.println(ior1);
	fileFE.close();
	rootPOA.the_POAManager().activate();
	orb.run();
	}

}
